import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// import * as ELIcons from '@element-plus/icons-vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import request from '@utils/request.js'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import { createPinia } from 'pinia'
import Directives from '@/utils/directives'
import installProjectComponents from '@/components/common'

const app = createApp(App)

app.config.globalProperties.$request = request

app.use(router).use(ElementPlus, { locale })

app.use(createPinia())

app.use(Directives)

installProjectComponents(app)

// for (let iconName in ELIcons) {
//   app.component(iconName, ELIcons[iconName])
// }
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app')
